<?php
/**
* 
*/
class getTokenAction extends Action
{
	public function get(){
	$appID = C('appID');
	$appsecret = C('appsecret');
	//dump($appID);
	$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.$appID.'&secret='.$appsecret;
	$ch = curl_init();
	curl_setopt($ch,CURLOPT_URL,$url);
	curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);
	curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,FALSE);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
	$data = curl_exec($ch);
	curl_close($ch);
	$data_array = json_decode($data,true);
	//dump($data_array);die;
	$access_token = $data_array['access_token'];
	//dump($access_token);die;
	return $access_token;
	}
}
?>